<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<LINK href="showAllOrg.files/style.htm" rel=stylesheet>
		<LINK href="showAllOrg.files/content.htm" rel=stylesheet>
		
		<script type="text/javascript">
		    var djConfig = {
				isDebug:true,
				parseOnLoad:true,
				usePlainJson:true
		    };
		</script>
		 
		<script type="text/javascript" src="dojo/dojo/dojo.js"></script>
		<script type="text/javascript" src="dojo/dijit/dijit.js"></script>

		<script type="text/javascript">
    		dojo.require("dijit.form.Button");
    		dojo.require("dojo.rpc.JsonService");    	
    	</script>
    	<script language="JavaScript" type="text/javascript">
    	var makeShipperNoteService = new dojo.rpc.JsonService("box/order/MakeShipperNoteService?smd");
		var isBoxAndGoodsPut = false;
		
		//页面加载时的一些操作
		dojo.addOnLoad(load);
		function load() {
			initPage();
		}
		//得到当前日期
		function showDate() {
			var today = new Date();   
			var day = today.getDate();   
			var month = today.getMonth() + 1;   
			var year = today.getFullYear();   
			return year + "-" + month + "-" + day;
		}
		//初始化页面
		function initPage() {
			makeShipperNoteService.getOrderPlanID().addCallback(function (result) {
				document.getElementById("sn_num1").value = result + "号十联单明细";
				document.getElementById("sn_num2").value = result;
			});
			makeShipperNoteService.getSnId().addCallback(function (snId) {
				document.getElementById("sn_id").innerHTML = snId;
			});
			
			var cur_date = showDate();
		
			//上次更改日期为当前日期
			document.getElementById("sn_last_modified_date").innerHTML = cur_date;
			//初始化日期为当前日期
			document.getElementById("sn_init_date").innerHTML = cur_date;

			makeShipperNoteService.getAllocDetails().addCallback(function (AD) {
				console.dir(AD);
				document.getElementById("shipcom_name").innerHTML = AD.commission.shipComInfo.fullTitle;
				document.getElementById("sender").innerHTML = AD.commission.sender.name;
				document.getElementById("receiver").innerHTML = AD.commission.receiver.name;
				document.getElementById("departure").innerHTML = AD.commission.departure;
				document.getElementById("receive_loc").innerHTML = AD.commission.receiveLoc;
				document.getElementById("unload_loc").innerHTML = AD.commission.destination;
				document.getElementById("destination").innerHTML = AD.commission.destination;
				document.getElementById("box_total").innerHTML = AD.bigNum + AD.smallNum;
				document.getElementById("goods_type").innerHTML = AD.commission.goods.type;
				if (AD.commission.goods.tempUnit != null) {
					document.getElementById("goods_temp").innerHTML = AD.commission.goods.temp;
				}
				if (AD.commission.multiShip == true) {
					document.getElementById("multiship").innerHTML = "Y";
				} else {
					document.getElementById("multiship").innerHTML = "N";
				}
				if (AD.commission.multiSchedule == true) {
					document.getElementById("multischedule").innerHTML = "Y";
				} else {
					document.getElementById("multischedule").innerHTML = "N";
				}
			});
			makeShipperNoteService.getOrderPlan().addCallback(function (orderPlan) {
				console.dir(orderPlan);
				document.getElementById("ship_schedule").innerHTML = orderPlan.shipSchedule.id;
				document.getElementById("ship_name").innerHTML = orderPlan.shipSchedule.shipInfo.name;
			});
		}
		//更新十联单
		function update_shipper_note() {
			makeShipperNoteService.updateShipperNote(document.getElementById("sn_id").innerHTML,
					document.getElementById("bl_id").value).addCallback(function (res) {
						alert(res);
						window.open("订舱管理-缮制十联单.htm", "_self");
					});
		}
		//关闭
		function close_shipper_note() {
			window.close();
		}
		//返回
		function go_back() {
			window.opener.focus();
			window.close();
		}
		//显示发货人信息
		function show_sender_info() {
			makeShipperNoteService.getAllocDetails().addCallback(function (AD) {
				console.dir(AD);
				var text = "";
				text = text + "<table width='760' border='0' cellspacing='0' cellpadding='0' align='center'>";
				text = text + "    <tr>";
				text = text + "        <td valign='top'>";
				text = text + "            <table width='760' align='center' cellpadding='2' cellspacing='1' class='gridarea'>"
				text = text + "                <tr>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>发货人</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>地址</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>联系人</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>电话</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>传真</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>邮箱</td>";
				text = text + "                </tr>";
				text = text + "                <tr class='gridtreven'>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.sender.name +"</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.sender.addr + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.sender.customerContact.name + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.sender.customerContact.OTel + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.sender.customerContact.fax + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.sender.customerContact.email + "</td>";
				text = text + "                </tr>";
				text = text + "            </table>";
				text = text + "        </td>";
				text = text + "    </tr>";
				text = text + "</table>";
				document.getElementById("show_results").innerHTML = text;
			});
		}
		//显示收货人信息
		function show_receiver_info() {
			makeShipperNoteService.getAllocDetails().addCallback(function (AD) {
				console.dir(AD);
				var text = "";
				text = text + "<table width='760' border='0' cellspacing='0' cellpadding='0' align='center'>";
				text = text + "    <tr>";
				text = text + "        <td valign='top'>";
				text = text + "            <table width='760' align='center' cellpadding='2' cellspacing='1' class='gridarea'>"
				text = text + "                <tr>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>收货人</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>地址</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>联系人</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>电话</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>传真</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>邮箱</td>";
				text = text + "                </tr>";
				text = text + "                <tr class='gridtreven'>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.receiver.name +"</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.receiver.addr + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.receiver.customerContact.name + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.receiver.customerContact.OTel + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.receiver.customerContact.fax + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.receiver.customerContact.email + "</td>";
				text = text + "                </tr>";
				text = text + "            </table>";
				text = text + "        </td>";
				text = text + "    </tr>";
				text = text + "</table>";
				document.getElementById("show_results").innerHTML = text;
			});
		}
		//显示通知人信息
		function show_notifier_info() {
			makeShipperNoteService.getAllocDetails().addCallback(function (AD) {
				console.dir(AD);
				var text = "";
				text = text + "<table width='760' border='0' cellspacing='0' cellpadding='0' align='center'>";
				text = text + "    <tr>";
				text = text + "        <td valign='top'>";
				text = text + "            <table width='760' align='center' cellpadding='2' cellspacing='1' class='gridarea'>"
				text = text + "                <tr>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>通知人</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>地址</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>联系人</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>电话</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>传真</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>邮箱</td>";
				text = text + "                </tr>";
				text = text + "                <tr class='gridtreven'>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.notifier.name +"</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.notifier.addr + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.notifier.customerContact.name + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.notifier.customerContact.OTel + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.notifier.customerContact.fax + "</td>";
				text = text + "                    <td width='90' align='center'>" + AD.commission.notifier.customerContact.email + "</td>";
				text = text + "                </tr>";
				text = text + "            </table>";
				text = text + "        </td>";
				text = text + "    </tr>";
				text = text + "</table>";
				document.getElementById("show_results").innerHTML = text;
			});
		}
		//显示货物信息
		function show_goods_info() {
			
				show_goods_info_real();

		}
		function show_goods_info_real() {
			makeShipperNoteService.getBoxAndGoods(document.getElementById("sn_id").innerHTML).addCallback(function (BAG) {
				console.dir(BAG);

				var bag = BAG.list;
				var totalBox = 0;
				var totalWeight = 0;
				var totalSize = 0;
				
				var text = "";
				text = text + "<table width='760' border='0' cellspacing='0' cellpadding='0' align='center'>";
				text = text + "    <tr>";
				text = text + "        <td valign='top'>";	
				text = text + "            <table width='760' align='center' cellpadding='2' cellspacing='1' class='gridarea'>";
				text = text + "                <tr>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>集装箱号</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>铅封号</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>箱数或件数</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>包装种类与货名</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>毛重(公斤)</td>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>尺码(立方米)</td>";
				text = text + "                </tr>";
				for (var i in bag) {
					text = text + "    <tr class='gridtreven'>";
					text = text + "        <td width='90' align='center'>" + bag[i].box.id +"</td>";
					text = text + "        <td width='90' align='center'>" + bag[i].box.leadSealing + "</td>";
					text = text + "        <td width='90' align='center'>" + bag[i].goodsNum + "</td>";
					text = text + "        <td width='90' align='center'>" + bag[i].goods.pack + ":" + bag[i].goods.name + "</td>";
					text = text + "        <td width='90' align='center'>" + bag[i].goods.weight * bag[i].goodsNum + "</td>";
					text = text + "        <td width='90' align='center'>" + bag[i].goods.size * bag[i].goodsNum + "</td>";
					text = text + "    </tr>";

					totalBox = totalBox + bag[i].goodsNum;
					totalWeight = totalWeight + bag[i].goods.weight * bag[i].goodsNum;
					totalSize = totalSize + bag[i].goods.size * bag[i].goodsNum;
				}
				//集装箱数或件数统计
				text = text + "                <tr class='gridtreven'>";
				text = text + "                    <td width='90' class='gridtitletd' align='center'>集装箱数或件数统计</td>";
				text = text + "                    <td width='90' align='center' colspan='5'>" + totalBox + " " + totalWeight + " " + totalSize + "</td>";
				text = text + "                </tr>";
				text = text + "             </table>";
				text = text + "          </td>";
				text = text + "       </tr>";
				text = text + "</table>";
				document.getElementById("show_results").innerHTML = text;
			});
		}
		//显示航线要求信息
		function show_route_request() {
			makeShipperNoteService.getAllocDetails().addCallback(function (AD) {
				console.dir(AD);
				var request1 = ['', '直达', '中转', '无要求'];
				var request2 = ['', '海运', '陆运', '陆海运', '无要求'];
				
				var routeRequest = AD.commission.routeRequest;
				var text = "";
				text = text + request1[routeRequest.direct] + ", " + request2[routeRequest.transport];
				
				document.getElementById("show_results").innerHTML = text;
			});
		}
		//显示费用信息
		function show_fee_info() {
			makeShipperNoteService.getAllocDetails().addCallback(function (AD) {
				console.dir(AD);

				var commitedService = AD.commission.commitedService;
				makeShipperNoteService.getFeeItems().addCallback(function (feeItems) {
					console.dir(feeItems);

					var fee = feeItems.list;
					makeShipperNoteService.getBoxAndGoods(document.getElementById("sn_id").innerHTML).addCallback(function (BAG) {
						console.dir(BAG);

						var bag = BAG.list;
						var weight = 0;
						for (var i in bag) {
							weight = weight + bag[i].goods.weight;
						}
						weight = weight * 1.0 / 1000;
						
						var text = "";
						text = text + "<table width='760' border='0' cellspacing='0' cellpadding='0' align='center'>";
						text = text + "    <tr>";
						text = text + "        <td valign='top'>";
						text = text + "            <table width='760' align='center' cellpadding=2' cellspacing='1' class='gridarea'>";
						text = text + "                <tr>"
						text = text + "                    <td class='gridtitletd' align='center'>费用条目</td>";
						text = text + "                    <td class='gridtitletd' align='center'>费率</td>";
						text = text + "                    <td class='gridtitletd' align='center'>数量</td>";
						text = text + "                    <td class='gridtitletd' align='center'>费用</td>";
						text = text + "                    <td class='gridtitletd' align='center'>预付或到付</td>";
						text = text + "                </tr>";

						var rowCnt = 0;
						//一定有海运费
						for (var i in fee) {
							if (fee[i].name == "海运费") {
								text = text + "<tr class='gridtreven'><td align='center'>海运费</td><td align='center'>" + fee[i].std + fee[i].unitName + "</td><td align='center'>100海里, " + weight + "吨</td><td align='center'>" + fee[i].std * weight + "</td>";
								if (AD.commission.prePay == true) {
									text = text + "<td align='center' id='prePay'>预付</td>";
								} else {
									text = text + "<td align='center' id='prePay'>到付</td>";
								}
								text = text + "</tr>";
								rowCnt++;
								break;
							}
						}
						if (commitedService.declare == true) {				//报关费
							for (var i in fee) {
								if (fee[i].name == "报关费") {
									text = text + "<tr class='gridtreven'><td align='center'>报关费</td><td align='center'>" + fee[i].std + fee[i].unitName + "</td><td align='center'>1单</td><td align='center'>" + fee[i].std + "</td></tr>";
									rowCnt++;
									break;
								}
							}
						}
						if (commitedService.inspect == true) {				//报检费
							for (var i in fee) {
								if (fee[i].name == "报检费") {
									rowCnt++;
									break;
								}
							}
						}
						if (commitedService.insure == true) {				//保险费
							for (var i in fee) {
								if (fee[i].name == "保险费") {
									rowCnt++;
									break;
								}
							}
						}
						if (commitedService.store == true) {				//仓储费
							for (var i in fee) {
								if (fee[i].name == "仓储费") {
									rowCnt++;
									break;
								}
							}
						}
						if (commitedService.trail == true) {				//拖车费
							for (var i in fee) {
								if (fee[i].name == "拖车费") {
									rowCnt++;
									break;
								}
							}
						}

						text = text + "            </table>";
						text = text + "        </td>";
						text = text + "    </tr>";
						text = text + "</table>";
						document.getElementById("show_results").innerHTML = text;
						document.getElementById("prePay").rowSpan = rowCnt;
					});
				});
			});
		}
		//备注
		function show_comments() {
			var text = "<textarea id='sn_comments' rows='8' cols='64'></textarea>";
			document.getElementById("show_results").innerHTML = text;
		}
	</script>
    	
<title>更新十联单</title>
</head>

<body>
<font face="隶书" color="3656B9" ; style="font-size: 18px;">更新十联单</font><br>
<img src="images/line2.gif"><br>

<center>

	<table width="700" border="0" cellpadding="0" cellspacing="0" >		
     	 <tr height="80">
       <td class="ctitle" ><input id="sn_num1" class ="billtitle" value="" size=40></td>
      </tr>
	</table>

	<table width="760" border="0" cellpadding="0" cellspacing="0" >
    <tr>
    <td	class="ctitle"  >上次更改日期：<input type="text" name="Bill_date" 
    id="sn_last_modified_date"  size=10 class="linputrl"></td>
	    
	
    <td class="ctitle"   >
    第<input  type="text" name="Bill_code"  id="sn_num2" size="19" class="linputrl"  >号
    </td>
	
	<td class="rtitle">单据类型：</td>  <td  	class="ltitle"><select name="Bill_type">
			<option value="I" selected="selected">初始化单据</option>
			  </select>        
          </td>
    </tr>
	</table>

	<table  class="titlearea" width="760" border="0" cellpadding="2" cellspacing="1">
      <tr >
			 <td		class="rtitle" width=95>*初始化日期：</td>
			
          <td  	id="sn_init_date" class="ltitle">2008-01-02         
          </td> 
          <td		class="rtitle" width=95>*十联单编码：</td>
          <td  id="sn_id"	class="ltitle">sc0011         
          </td>
		  <td		class="rtitle" width=95>*联数：</td>
          <td  	class="ltitle">第一联         
          </td>
      </tr >
		   <tr>
		   <td		class="rtitle" width=95>B/L NO.：</td>
          <td  	class="ltitle"><input type="text" name="ware_empid"
          id="bl_id" 	  size=10 class="linput" >         
          </td>
		   <td		class="rtitle" width=95>TO：</td>
          <td  id="shipcom_name"	class="ltitle">华东海运有限公司         
          </td>
		  <td		class="rtitle" width=95>FROM：</td>
          <td  	class="ltitle">哈工大货代         
          </td>
		  </tr>
		   <tr>
		   <td		class="rtitle" width=95>发货人：</td>
          <td  id="sender"	class="ltitle">威海出口公司         
          </td>
		   <td		class="rtitle" width=95>收货人：</td>
          <td id="receiver" 	class="ltitle">韩国进口公司         
          </td>
		  <td		class="rtitle" width=95>代理：</td>
          <td  	class="ltitle">哈工大货代         
          </td>
		  </tr>

             <tr >
			 <td		class="rtitle" width=95>船名：</td>
			
          <td id="ship_name" 	class="ltitle">华东明珠2号         
          </td> 
          <td		class="rtitle" width=95>船次：</td>
          <td  id="ship_schedule" 	class="ltitle">1342         
          </td>
		  <td		class="rtitle" width=95>装货港：</td>
          <td id="departure" 	class="ltitle">SHIDAO,CHINA         
          </td>
		   </tr >
		   <tr >
			 <td		class="rtitle" width=95>前程运输：</td>
			
          <td  	class="ltitle"><input type="text" name="Init_date"
          value="" 	  size=10 class="linput" >         
          </td> 
          <td		class="rtitle" width=95>收货地点：</td>
          <td  	class="ltitle"><input type="text" name="Ware_id"
         id="receive_loc" value="" 	  size=10 class="linput" >         
          </td>
		  
		   </tr >
		   <tr >
			 <td		class="rtitle" width=95>卸货港：</td>
			
          <td  id="unload_loc" 	class="ltitle">INCHON,KOREA         
          </td> 
          <td		class="rtitle" width=95>目的港：</td>
          <td id="destination" 	class="ltitle">INCHON,KOREA         
          </td>
		  <td		class="rtitle" width=95>交货地点：</td>
          <td  	class="ltitle"><input type="text" name="Ware_name"
          value="" 	  size=10 class="linput" >         
          </td>
		   </tr >
		   <tr >
			 <td		class="rtitle" width=95>集装箱数：</td>
			
          <td  id="box_total"	class="ltitle">5         
          </td> 
          <td		class="rtitle" width=95>货物种类：</td>
          <td id="goods_type" 	class="ltitle">普通         
          </td>
		  <td		class="rtitle" width=95>冷藏程度：</td>
          <td id="goods_temp" 	class="ltitle">常温         
          </td>
		   </tr >
		   <tr>
		    <td		class="rtitle" width=95>可否转船：</td>
			
          <td id="multiship" 	class="ltitle">N         
          </td> 
          <td		class="rtitle" width=95>可否分批：</td>
          <td  id="multischedule"	class="ltitle">N         
          </td>
		  <td		class="rtitle" width=95>装期：</td>
          <td  	class="ltitle"><input type="text" name="Ware_name"
          value="" 	  size=10 class="linput" >         
          </td>
		   </tr >
		   <tr>
		    <td		class="rtitle" width=95>有效期：</td>
			
          <td  	class="ltitle"><input type="text" name="Init_date"
          value="" 	 id="sn_date_of_expiry"  size=10 class="linput" >         
          </td> 
          <td		class="rtitle" width=95>装箱场站名称：</td>
          <td  	class="ltitle"><input type="text" name="Ware_id"
          id="cy_id" 	  size=10 class="linput" >         
          </td>
		  
		   </tr >
			
  
	  <tr>
          <td class="rtitle">审批状态：</td><td class="ltitle">  
          
			处理中
		  
		  </td>
          <td class="rtitle">审批流程：</td><td class="ltitle" colspan="3">        
          <input name="Check_flow_id"   type="hidden" value="StoreStart001" size="10" class="linputrl">
          <input name="Check_flow_name" type="text"   value="缮制第一联" size="20" class="linputr">
          <input name="Audit_state_flag" type="hidden" value="S" size="10" class="linputrl">
          </td>
      </tr>
	  
	</table>

<table width="760">
    <tr>
      <td class="rtitle">
	   
	   
      <font face="Webdings" class="redcolor">4</font><a href="#" onClick="update_shipper_note()">更新</a>
      
   
      
	   
	  
	    
      <font face="Webdings" class="redcolor">4</font><a href="javascript:close_shipper_note()">关闭</a>
      
      
      <font face="Webdings" class="redcolor">4</font><a href="javascript:go_back()">返回</a>
      
	  </td>
	</tr>
</table>

<div id="associate_details">
				<div>
					<table width="760">
						<tr>
							<td align="left">
								<a href="#" onClick="show_sender_info()">发货人信息</a>
								<a href="#" onClick="show_receiver_info()">收货人信息</a>
								<a href="#" onClick="show_notifier_info()">通知人信息</a>
								<a href="#" onClick="show_goods_info()">货物信息</a>
								<a href="#" onClick="show_route_request()">航线要求</a>
								<a href="#" onClick="show_fee_info()">费用信息</a>
								<!-- <a href="#" onClick="show_comm_info()">委托信息</a> -->
								<a href="#" onClick="show_comments()">备注</a>
							</td>
						</tr>
					</table>
				</div>
				<div id="show_results"></div>
			</div>

</center>

</body>
</html>


